<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>企业管理系统</title>

    <!-- Bootstrap -->
    <link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="css/list.css" rel="stylesheet">
    <link href="css/detail.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid clear">
    <div class="nav-menu">
        <div class="nav navbar-nav navbar-left">
            <a href="">
                企业管理系统
            </a>
        </div>
        <div class="nav navbar-nav navbar-right">
            <li class="dropdown">
                <a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                    ${empty sessionScope.user.nickName ? '用户昵称未设置' : sessionScope.user.nickName }
                    <span class="caret"></span></a>
                <ul class="dropdown-menu">
                    <li><a href="users/setting.jsp">设置</a></li>
                    <li role="separator" class="divider"></li>
                    <li><a href="logout">退出</a></li>
                </ul>
            </li>
        </div>
        <div class="clear"></div>
    </div>
    <div class="back-box">
        <a href="${pageContext.request.contextPath}/users?type=list" class="back-btn  btn-default btn-lg">&lt;&nbsp;返&nbsp;&nbsp;回</a>
    </div>
    <div class="container content-box">
        <div class="row detail-title">
            <span>
               <span>${empty requestScope.DATA.nickName ? '<未设置用户名>' : requestScope.DATA.nickName }</span>
                用户详细信息
            </span>
        </div>
        <div class="row">
            <div class="detail-box">
                <form class="form-horizontal" method="post" action="users?type=${param.type}">
                    <div class="form-group hidden">
                        <label for="input-user-id" class="col-sm-offset-2 col-sm-2 control-label">用户主键</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control input-lg" id="input-user-id" readonly name="id" value="${requestScope.DATA.id}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-offset-2 col-sm-2 control-label">用户账户</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control input-lg" id="inputEmail3" name="login_id" value="${requestScope.DATA.loginId}"
                                readonly
                            >
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="input-user-password" class="col-sm-offset-2 col-sm-2 control-label">用户密码</label>
                        <div class="col-sm-4">
                            <input type="password" class="form-control input-lg" id="input-user-password" disabled name="password"
                                   value="${requestScope.DATA.password}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="input-user-nickname" class="col-sm-offset-2 col-sm-2 control-label">用户昵称</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control input-lg" id="input-user-nickname" name="nick_name"
                                   value="${requestScope.DATA.nickName}" ${param.type ne 'view' ? '' : 'readonly' }>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="input-user-dept_id" class="col-sm-offset-2 col-sm-2 control-label">关联员工</label>
                        <div class="col-sm-4">
                            <c:choose>
                                <c:when test="${param.type eq 'edit'}">
                                    <select id="input-user-dept_id" class="form-control input-lg" name="staff_id" >
                                        <c:forEach var="item" items="${requestScope.OTHERDATA.STAFFS}">
                                            <option value="${item.id}" ${requestScope.DATA.staffId eq item.id ? 'selected' : ''}>${item.name}</option>
                                        </c:forEach>
                                    </select>
                                </c:when>
                                <c:otherwise>
                                   <c:choose>
                                       <c:when test="${empty requestScope.DATA.staffId}">
                                           未绑定相关员工信息
                                       </c:when>
                                       <c:otherwise>
                                           <a href="${pageContext.request.contextPath}/staffs?type=view&id=${requestScope.DATA.staffId}">查看关联员工信息</a>
                                       </c:otherwise>
                                   </c:choose>
                                </c:otherwise>
                            </c:choose>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-offset-2 col-sm-2 control-label">创建时间</label>
                        <div class="col-sm-4">
                            <input type="datetime-local" class="form-control input-lg" name="created_time" placeholder="创建时间" readonly
                                   value="${requestScope.DATA.createdTime}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-offset-2 col-sm-2 control-label">最近修改时间</label>
                        <div class="col-sm-4">
                            <input type="datetime-local" class="form-control input-lg" name="update_time" placeholder="最近修改时间" readonly
                                   value="${requestScope.DATA.updateTime}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-offset-2 col-sm-2 control-label">账户状态</label>
                        <div class="col-sm-4">
                            <label class="radio-inline">
                                <input type="radio" name="disable"  ${requestScope.DATA.disable ? 'checked' : ''}
                                    ${param.type ne 'view' ? '' : 'disabled' }   value="1"> 停用
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="disable" ${requestScope.DATA.disable ? '' : 'checked' }
                                    ${param.type ne 'view' ? '' : 'disabled' }  value="0"> 正常
                            </label>
                        </div>
                    </div>
                    <div class="form-group ${param.type ne 'view' ? '' : 'hidden'}">
                        <div class="col-sm-offset-3 col-sm-6">
                            <button type="submit" class="btn btn-info btn-lg">提交并保存</button>
                        </div>
                    </div>
                </form>

            </div>
        </div>
    </div>
</div>
</body>
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
<script src="${pageContext.request.contextPath}/jQuery/jquery-3.5.1.min.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script src="${pageContext.request.contextPath}/bootstrap-3.3.7/js/bootstrap.min.js"></script>
</html>